import { request } from "@/utils/service"
import * as Grade from "@/api/grade/types/grade"

/**
 * 增
 * @param data 请求参数
 * @constructor
 */
export function AddGradeApi(data: Grade.IAddGradeRequestData) {
  return request<Grade.AddGradeResponseData>({
    url: "theclass/addOne",
    method: "post",
    data
  })
}

/**
 * 删
 * @param id 项目id
 * @constructor
 */
export function DeleteGradeApi(id: number) {
  return request<Grade.DeleteGradeResponseData>({
    url: "theclass/deleteOne",
    method: "delete",
    params: { id }
  })
}

/**
 * 改
 * @param data
 * @constructor
 */
export function UpdateGradeApi(data: Grade.IUpdateGradeRequestData) {
  return request<Grade.UpdateGradeResponseData>({
    url: "theclass/updateOne",
    method: "put",
    data
  })
}

/**
 * 条件查询+分页查询
 * @param data
 * @constructor
 */
export function FindGradeByCondApi(data: Grade.IGetGradeRequestData) {
  return request<Grade.GetGradeResponseData>({
    url: "theclass/getList",
    method: "post",
    data
  })
}

/**
 * 查询班级ID和班级名
 * @param data
 * @constructor
 */
export function GetGradeIdAndNameList(data: Grade.IGetGradeIdAndName) {
  return request<Grade.GetGradeResponseData>({
    url: "theclass/getIdAndNameList",
    method: "post",
    data
  })
}
